// 3.3vite.config.ts具体配置
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import ElementPlus from 'unplugin-element-plus/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import path from 'path'

export default defineConfig({
  base: './',
  // ...
  plugins: [
    // ...
    AutoImport({
      resolvers: [ElementPlusResolver()],
    }),
    Components({
      resolvers: [ElementPlusResolver({importStyle: 'sass'})],
    }),
    vue(),
    ElementPlus({
      useSource: true,
    }),
  ],
  resolve:{
    alias:{
      '@':path.resolve(__dirname,'./src')
    }
  },
  css: {
    preprocessorOptions: {
      scss: {
        additionalData: `@use "@/theme/css/themes.scss" as *;`
        // javascriptEnabled: true
      }
    }
  },
  server: {
    // 是否开启 https
    https: false,
    // 端口号
    port: 80,
    host: '0.0.0.0',
  },
})
